#!/bin/sh
PATH=$PATH:/home/ora10g/scripts ; export PATH
STATUS_DIR=/oracle/backup/BK_STATUS
BK_STATUS=/oracle/backup/log/BK_STATUS
MSG_LOG=/backup/MY10G/joblog_`date +%Y%m`.log ;export MSG_LOG
JOBNAME=Rman_Backup          ; export JOBNAME

ORACLE_SID=my10g; export ORACLE_SID
ORACLE_BASE=/ybq61/oracle; export ORACLE_BASE
ORACLE_HOME=/ybq61/oracle/oracle/product/10.2.0/db_1; export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME:$ORACLE_HOME/bin; export PATH
Date_Num=`date +%u`

MSG_JOB S

if [[ Date_Num -eq 6 ]] then
  rman cmdfile=/home/ora10g/scripts/Fullback.rman log=/home/ora10g/scripts/rmanlog_`date +%Y%m%d`.log
  if [[ $? -eq 0 ]] then
    MSG_JOB I 'Full Backup Finish'
  else
    MSG_JOB I 'Full Backup Error'
  fi
else
  rman cmdfile=/home/ora10g/scripts/Incrback.rman log=/home/ora10g/scripts/rmanlog_`date +%Y%m%d`.log
  if [[ $? -eq 0 ]] then
    MSG_JOB I 'Incremental Backup Finish'
  else
    MSG_JOB I 'Incremental Backup Error'
  fi
fi
MSG_JOB N